<%--
  Created by IntelliJ IDEA.
  User: q7792
  Date: 2018/11/28
  Time: 23:38
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" pageEncoding="utf-8" %>

<%@ include file="/resources/layout/head.jsp"%>

<div class="navbar navbar-default" role="navigation">
    <div class="navbar-header">
        <a class="" href="index.html"><span class="navbar-brand"><span class="fa fa-paper-plane"></span> 人事管理系统</span></a></div>

    <div class="navbar-collapse collapse" style="height: 1px;">

    </div>
</div>
</div>

<div class="dialog">
    <div class="panel panel-default">
        <p class="panel-heading no-collapse" style="font-size: 18px">登&nbsp;陆</p>
        <div class="panel-body">
            <form id="dataForm">
                <div class="form-group">
                    <label>用户名</label>
                    <input type="text" name="login_name" class="form-control span12">
                </div>
                <div class="form-group">
                    <label>密码</label>
                    <input type="password" name="login_pwd" class="form-controlspan12 form-control">
                </div>
                <div class="form-group">
                    <label>
                        <input type="radio" name="person" value="admin" checked>管理员
                        <input type="radio" name="person" value="user">用户
                    </label>
                </div>
                <input type="submit" class="btn btn-primary pull-right" value="登 陆">
                <label class="remember-me"><input type="checkbox" name="remember"> 记住我</label>
                <div class="clearfix"></div>
            </form>
        </div>
    </div>
    <p class="pull-right" style=""><a href="#" target="blank"> 注 册 </a></p>
    <p><a href="reset-password.html"> 忘记密码?</a></p>
</div>

<script src="<%=request.getContextPath()%>/resources/lib/bootstrap/js/bootstrap.js"></script>
<script src="<%=request.getContextPath()%>/resources/lib/bootstrap/js/toastr.min.js"></script>
<script type="text/javascript">
    toastr.options.positionClass = 'toast-center-center';

    $(function() {

        $("#dataForm").submit(function () {
            var data = $("form").serialize();
            $.post("./checkLogin", data,function (result) {
                var msg = result.msg;
                if (1 == result.code){
                    toastr.success(msg);
                    setTimeout(function () {
                        window.location.href = "./index";
                    }, 800);
                } else {
                    toastr.warning(msg);
                }
            });
            return false;
        })
    });
</script>


</body></html>
